-- UNITDEF -- KNIGHT --
--------------------------------------------------------------------------------

local unitName = "knight"

--------------------------------------------------------------------------------

local unitDef = {
  acceleration       = 0.75,
  brakeRate          = 0.75,
  buildCostMetal     = 10,
  canAttack          = true,
  canMove            = true,
  canstop            = 1,
  category           = [[PLAYER UNARMORED UNIT TARGET]], --this is for target designating
  collisionvolumetest = 1,
  customParams        = {
   	toggle1 = 2,
	toggle1on = [[Secondary]],
	toggle1off = [[Primary]],
	toggle1tooltip = [[Switch between weapons]],
    helptext       = [[The Knight specializes in close combat and has a jump jet ability and a sword as a secondary weapon]],
     },
  corpse              = [[DEAD]],
  description        = [[Assault Engine]],
  energyMake         = 0,
  energyStorage      = 0,
  explodeAs          = [[Death]],
  footprintX         = 2,
  footprintZ         = 2,
  iconType           = [[Knight]],
  idleAutoHeal       = 0,
  idleTime           = 30,
  levelGround        = false,
  maxDamage          = 1000,
  maxthisunit        = 1,
  maxVelocity        = 2, -- walk was 1.5
  metalMake          = 0,
  metalStorage       = 0,
  movementClass      = [[ENGINE]],
  name               = [[Kusanagi]],  ---J: Kusanagi =Japanese excalibur K:Simsang Geombeop -heart of sword technique
  noChaseCategory    = [[NOTARGET AIR]],
  objectName         = [[knight.s3o]],
  radarDistance      = 0,
  reclaimable        = false,
  seismicSignature   = 1,
  selfDestructAs     = [[Death]],
  selfDestructCountdown = 3, --give time to change mind
  showNanoFrame      = false,
  showPlayerName     = true,
  sightDistance      = 900, --- pawn 800 player 900?
  smoothAnim         = true, --smooths kbot animation
  turnInPlace	    = 1,  --need for strafing
  turnRate           = 1500,
  unitname           = [[knight]],
  upright            = true,
  sfxtypes = {
    explosiongenerators = {
	[[custom:flashmuzzle1]],
    [[custom:JumpTrail]],  -- ah this was what was playing up!
    [[custom:JumpImpact]],  -- need to readd these effects later with new tex
	[[custom:burning]],
 },						-- have a new texture to try - lets see what it looks like
  },
  -- sounds = {
    -- arrived = {
      -- [[commandgiven]],
    -- },
    -- ok = {
      -- [[commandgiven]],
    -- },
    -- select = {
      -- [[select]],
    -- },
  -- },
  weapons = {
    [2]  = {
    --  badTargetCategory  = [[ARMORED]],
      def                = [[gunk1]],
      onlyTargetCategory = [[TARGET]],
	  mainDir            = [[0 0 1]], --- wont read quotes
      maxAngleDif        = 170,
    },
    [1]  = {
      def                = [[swordk1]],
      onlyTargetCategory = [[TARGET]],
	  mainDir            = [[0 0 1]], --- wont read quotes
      maxAngleDif        = 200,  --- 180 is a pain to aim
    },
	[3]  = {
      def                = [[Stomp]],
	  badtargetcategory  = [[PLAYER BASE]],		
      onlyTargetCategory = [[SMALL]],
    },
  },
}


--------------------------------------------------------------------------------

local weaponDefs = {
  Gunk1 = {
    avoidFriendly      = false,
    burst              = 4,
    burstrate          = .1, -- was .3 but 2nd or 3rd shot may miss due to time on target
    CanAttackGround = false, ---defaut is true
    collideFriendly    = false,
    craterBoost        = 0,
    craterMult         = 0,
    duration           = .03,
    explosionGenerator = [[custom:none]],
    id                 = 1,
    impactonly         = 1,
    impulseBoost       = 0,
    impulseFactor      = 0,
    interceptedByShieldType = 0,
    name               = [[SMG]],
    range              = 400,
    reloadtime         = 3,
    rgbColor           = [[1 1 .2]],
    soundStart         = [[knightshot]],
    sprayAngle         = 800,
    thickness          = 1,
    tolerance          = 400,
    turret             = true,
    weaponType         = [[LaserCannon]],
    weaponVelocity     = 1000,
    damage = {
      default            = 20,
    },
  },
  swordk1 = {
    areaOfEffect       = 24,
    avoidFeature       = false,
    avoidFriendly      = false,
    avoidneutral       = 0,
    beamDecay          = 0.90,
    beamTime           = 0.05,
    beamTTL            = 5,
	CanAttackGround = false,
    collideFeature     = true,
    collideFriendly    = false,
    collideneutral     = 1,
    collisionSize      = 24,
    coreThickness      = 0,
    craterBoost        = 0,
    craterMult         = 0,
    cylinderTargetting = 0,
    edgeEffectiveness  = 1,
    explosionGenerator = [[custom:none]],
    explosionSpeed     = 65536,
    fireStarter        = 0,
    impulseBoost       = 3,
    impulseFactor      = 1,
    intensity          = 0.0,
    name               = [[Sword]],
    noSelfDamage       = true,
    ProximityPriority = 2;
    range              = 60,  --was 25 in plan, 100 works
    reloadtime         = 1, --put back to 3 when fixed
    rgbColor           = [[0.0  0.0  0.0]],
    soundHit           = [[nadehit]],
    sprayAngle         = 1600,
    targetBorder       = 1,
    targetMoveError    = 0,
    thickness          = 0.01,
    tolerance          = 5000,
    turret             = true,
    waterWeapon        = true,
    weaponType         = [[BeamLaser]],
    weaponVelocity     = 500,
    damage = {
      default            = 240,  --120 in pre svn
    },
  },	
  Stomp       = {
      name                    = [[Stomp]],
      areaOfEffect            = 84,
      collideFriendly         = false,
      craterBoost             = 1,
      craterMult              = 1,

      damage                  = {
        default = 0,
		small = 50,
      },

      edgeEffectiveness       = 0.5,
      explosionGenerator      = [[custom:NONE]],
      impulseBoost            = 2, --might have to adjust
      impulseFactor           = 0.2,
      intensity               = 1,
      interceptedByShieldType = 1,
      lineOfSight             = false,
      noSelfDamage            = true,
      range                   = 30,
      reloadtime              = 1,
      renderType              = 4,
      rgbColor                = [[1 1 1]],
      thickness               = 1,
      tolerance               = 100,
      turret                  = true,
      weaponType              = [[Cannon]],
      weaponVelocity          = 0.8,
    },

}
unitDef.weaponDefs = weaponDefs

local featureDefs = {
    DEAD  = {
      description      = [[Wreckage - Knight]],
      blocking         = true,
      category         = [[corpses]],
      damage           = 3000,
      energy           = 0,
	  featureDead      = [[HEAP]],
      featurereclamate = [[SMUDGE01]],
      footprintX       = 3,
      footprintZ       = 4,
      height           = [[20]],
      hitdensity       = [[100]],
      metal            = 0,
      object           = [[knight_dead.s3o]],
      reclaimable      = false,
      reclaimTime      = 0,
      world            = [[All Worlds]],
    },
	
	 HEAP  = {
      description      = [[Debris - Engine]],
      blocking         = false,
      category         = [[heaps]],
      damage           = 1000,
      energy           = 0,
      featurereclamate = [[SMUDGE01]],
      footprintX       = 3,
      footprintZ       = 4,
      height           = [[4]],
      hitdensity       = [[100]],
      metal            = 0,
      object           = [[engine_heap.s3o]],
      reclaimable      = false,
      reclaimTime      = 0,
      seqnamereclamate = [[TREE1RECLAMATE]],
      world            = [[All Worlds]],
    },
  }
  unitDef.featureDefs = featureDefs
--------------------------------------------------------------------------------

return lowerkeys({ [unitName] = unitDef })

--------------------------------------------------------------------------------
